import {
  Controller,
  Inject,
  Get,
  Query,
  Body,
  Post,
  Param,
  Del,
} from '@midwayjs/core';
import { CopyService } from '@service/jx3/copy.service';
import { ListCopyDTO } from '@dto/jx3/copy.dto';
import { BusinessType, Log } from '@decorator/log.decorator';

@Controller('/jx3/copys')
export class PostController {
  @Inject()
  CopyService: CopyService;
  // 获取列表
  @Get('/list')
  async list(@Query() queryParams: ListCopyDTO) {
    return await this.CopyService.list(queryParams);
  }

  // 新增
  @Log({ title: 'jx3_copy新增', businessType: BusinessType.ADD })
  @Post('/add')
  async create(@Body() Copy: any) {
    return await this.CopyService.create(Copy);
  }

  // 删除
  @Log({ title: 'jx3_copy删除', businessType: BusinessType.REMOVE })
  @Del('/:CopyId')
  async delete(@Param('CopyId') CopyId: string) {
    return await this.CopyService.delete(CopyId);
  }

  // 修改
  @Log({ title: 'jx3_copy修改', businessType: BusinessType.EDIT })
  @Post('/update')
  async update(@Body() Copy: any) {
    return await this.CopyService.update(Copy);
  }

  // 获取jx3_copy详情
  @Get('/:CopyId')
  async get(@Param('CopyId') CopyId: string) {
    return await this.CopyService.detail(CopyId);
  }
}
